package com.zx.config;

import com.zx.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/main/**","/user/login","/message/**",
                        "/user/ordinary","/user/agentCheckin","/user/forget","/user/forgetCheck",
                        "/user/checkin", "/user/signUp", "/templates/**",
                        "/static/**","/asserts/**","/webjars/**","/templates/**");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/images/**").addResourceLocations("file:C:\\Users\\63055\\Pictures\\foodshare\\images\\");
    }
}